GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#573)
by Jesus
04:29
created

$(document).turbolinks:load   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 11
rs 10
1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
$(document).on('turbolinks:load', function(){
18
  var controller = $("body").data('controller');
19
  var action = $("body").data('action');
20
21
  // Only run on the admins page.
22
  if (controller == "admins" && action == "index") {
23
    // show the modal with the correct form action url
24
    $(".delete-user").click(function(data){
25
      var uid = $(data.target).closest("tr").data("user-uid")
26
      var url = $("body").data("relative-root")
27
      if (!url.endsWith("/")) {
28
        url += "/"
29
      }
30
      url += "u/" + uid
31
      $("#delete-confirm").parent().attr("action", url)
32
    })
33
34
    //clear the role filter if user clicks on the x
35
    $(".clear-role").click(function() {
36
      var search = new URL(location.href).searchParams.get('search')
0 ignored issues
show
Bug introduced by
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
37
38
      var url = window.location.pathname + "?page=1"
39
    
40
      if (search) {
41
        url += "&search=" + search
42
      }  
43
    
44
      window.location.replace(url);
45
    })
46
    
47
    /* COLOR SELECTORS */
48
    
49
    $('#colorinput-regular').ColorPicker({
50
      onBeforeShow: function () {
51
        var colour = rgb2hex($("#colorinput-regular").css("background-color"))
52
53
        $(this).ColorPickerSetColor(colour);
54
      },
55
      onSubmit: function(_hsb, hex) {
56
        $.post($("#coloring-path-regular").val(), {color: '#' + hex}).done(function() {
57
          location.reload()
58
        });
59
      },
60
    });
61
62
    $('#colorinput-lighten').ColorPicker({
63
      onBeforeShow: function () {
64
        var colour = rgb2hex($("#colorinput-lighten").css("background-color"))
65
66
        $(this).ColorPickerSetColor(colour);
67
      },
68
      onSubmit: function(_hsb, hex) {
69
        $.post($("#coloring-path-lighten").val(), {color: '#' + hex}).done(function() {
70
          location.reload()
71
        });
72
      },
73
    });
74
75
    $('#colorinput-darken').ColorPicker({
76
      onBeforeShow: function () {
77
        var colour = rgb2hex($("#colorinput-darken").css("background-color"))
78
79
        $(this).ColorPickerSetColor(colour);
80
      },
81
      onSubmit: function(_hsb, hex) {
82
        $.post($("#coloring-path-darken").val(), {color: '#' + hex}).done(function() {
83
          location.reload()
84
        });
85
      },
86
    });
87
  }
88
89
  // Only run on the admins edit user page.
90
  if (controller == "admins" && action == "edit_user") {
91
    $(".setting-btn").click(function(data){
92
      var url = $("body").data("relative-root")
93
      if (!url.endsWith("/")) {
94
        url += "/"
95
      }
96
      url += "admins?setting=" + data.target.id
97
98
      window.location.href = url
99
    })
100
  }
101
});
102
103
// Change the branding image to the image provided
104
function changeBrandingImage(path) {
105
  var url = $("#branding-url").val()
106
  $.post(path, {url: url})
107
}
108
109
// Filters by role
110
function filterRole(role) {
111
  var search = new URL(location.href).searchParams.get('search')
0 ignored issues
show
Bug introduced by
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
112
113
  var url = window.location.pathname + "?page=1" + "&role=" + role
114
115
  if (search) {
116
    url += "&search=" + search
117
  }  
118
119
  window.location.replace(url);
120
}
121
122
function rgb2hex(rgb) {
123
  rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
124
  function hex(x) {
125
      return ("0" + parseInt(x).toString(16)).slice(-2);
126
  }
127
  return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
128
}
129
130